import json

import requests

url = "https://testmockserver.rta-os.com/dubboJump"

headers = {
    # "Content-Type": "application/json; charset=UTF-8",
    "dmall_chain_flag": 'gray04'
}

data = {
    "className": "com.rta.promotion.client.api.PromoOfflineService",
    "methodName": "calcPromotion",
    "params": [
        {
            "anfieldMember": False,
            "barCodeList": [
                "2023011711001",
                "2023011711002",
                "2023011711003",
                "2023011711004"
            ],
            "calcMemberPrice": False,
            "invokeSysName": "python",
            "platForm": "POS",
            "skus": [
                {
                    "addTime": 1697551721070,
                    "buyQty": 0,
                    "checked": True,
                    "jointFlag": 99,
                    "matchSimplePro": True,
                    "origPrice": 0,
                    "packNum": 1,
                    "packPrice": 500,
                    "pluType": 5,
                    "skuId": 106239543,
                    "skuName": "商品A",
                    "skuType": "MAIN_SKU",
                    "storeId": 107494,
                    "unitPackCount": 1,
                    "venderId": 10032,
                    "wareType": "NORMAL",
                    "wareWeight": 1.0,
                    "uniqueId": "6dNXl4JpyH_106239543_1697551721070",
                    "priceChanged": False,
                    "catExtendInfo": {},
                    "extendInfoMap": {}
                },
                {
                    "addTime": 1697551721071,
                    "buyQty": 0,
                    "checked": True,
                    "jointFlag": 99,
                    "matchSimplePro": True,
                    "origPrice": 0,
                    "packNum": 1,
                    "packPrice": 600,
                    "pluType": 5,
                    "skuId": 106239563,
                    "skuName": "商品B",
                    "skuType": "MAIN_SKU",
                    "storeId": 107494,
                    "unitPackCount": 1,
                    "venderId": 10032,
                    "wareType": "NORMAL",
                    "wareWeight": 1.0,
                    "uniqueId": "6dNXl4JpyH_106239563_1697551721071",
                    "priceChanged": False,
                    "catExtendInfo": {},
                    "extendInfoMap": {}
                },
                {
                    "addTime": 1697551721072,
                    "buyQty": 0,
                    "checked": True,
                    "jointFlag": 99,
                    "matchSimplePro": True,
                    "origPrice": 0,
                    "packNum": 1,
                    "packPrice": 700,
                    "pluType": 5,
                    "skuId": 106239728,
                    "skuName": "商品C",
                    "skuType": "MAIN_SKU",
                    "storeId": 107494,
                    "unitPackCount": 1,
                    "venderId": 10032,
                    "wareType": "NORMAL",
                    "wareWeight": 1.0,
                    "uniqueId": "6dNXl4JpyH_106239728_1697551721072",
                    "priceChanged": False,
                    "catExtendInfo": {},
                    "extendInfoMap": {}
                }
            ],
            "storeId": 107494,
            "storeName": "python門店名",
            "terminal": "PC",
            "userId": 17923,
            "userTypes": None,
            "venderId": 10032,
            "staffPromoCalcPara": None,
            "venderName": "python商家名",
            "showCashierAlert": False,
            "channel": "POS"
        }
    ]
}
import json
res = requests.post(url, json=data, headers=headers, verify=False)
res = json.loads(res.json()).get('response', None)
res_json = json.dumps(res)
res_str = res_json.replace('\\n', '').replace('\\t', '').replace('false', 'False').replace('true', 'True')

res_j = json.loads(res_str)

res_dict = eval(res_j)
print(res_dict)
res_data = json.dumps(res_dict['data'])
print(res_data)
